<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>

<s:url value="/images" var="imgPath" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script type="text/javascript" charset="UTF-8"
	src="/js/formValidator.js" charset="UTF-8"></script>
<script type="text/javascript" charset="UTF-8"
	src="/js/formValidatorRegex.js" charset="UTF-8"></script>
<!-- 月历 -->
<script type="text/javascript" charset="UTF-8"
	src="/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8"
	src="/js/jquery.datepick-zh-CN.js"></script>
<!-- 時間 -->
<script type="text/javascript" src="/js/jquery.timePicker.js"></script>
<link rel="stylesheet" type="text/css" href="/js/timePicker.css" />
<script type="text/javascript" charset="UTF-8"
	src="/css/jquery-ui-1.7.2.custom.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="/css/jquery-ui-1.7.2.custom.css" />
<link rel="stylesheet" type="text/css"
	href="/css/smoothness.datepick.css" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script language="javascript">
	function seek(specId, specName) {
		var specId = document.getElementById(specId).value;

		jQuery.post("/ecadmin/jdGift/jsonStr.do?produtId=" + specId, function(
				str) {
			document.getElementById(specName).value = str;

		});

	}

	$()
			.ready(
					function() {

						var uniId = 1;

						$("#addCol")
								.click(
										function() {

											var htmlC = "<tr id=\"col_"+uniId+"\"><td><input type=\"text\" name=\"specId\" id=\"specId_"
													+ uniId
													+ "\" size=\"10\" maxlength=\"10\" value=\"\" onblur=\"seek('specId_"
													+ uniId
													+ "','specName_"
													+ uniId
													+ "')\"></td>"
													+ "<td><input type=\"text\" name=\"y1\" size=\"50\" maxlength=\"40\" value=\"\" id=\"specName_"+uniId+"\" disabled></td>"
													+ "<td><input type=\"text\" name=\"qty\" size=\"5\" maxlength=\"4\" value=\"\"></td>"
													+ "<td><input type=\"button\" name=\"deleteRow\" value=\"删除\" onClick=\"javascript:deleteThisRow('col_"
													+ uniId + "')\"></td>"
											"</tr>";
											$("#addColHere").append(htmlC);
											uniId++;

										});

						$('#startDate').datepick({
							minDate : null,
							showOn : 'both',
							buttonImageOnly : true,
							buttonImage : '${imgPath}/calendar.gif',
							numberOfMonths : 2,
							dateFormat : "yy-mm-dd",
							yearRange : '-50:+50'
						});
						$('#endDate').datepick({
							minDate : new Date(),
							showOn : 'both',
							buttonImageOnly : true,
							buttonImage : '${imgPath}/calendar.gif',
							numberOfMonths : 2,
							beforeShow : customRange,
							dateFormat : "yy-mm-dd",
							yearRange : '-50:+50'
						});
						function customRange() {
							var startDt = $('#startDate').val(); //起始日
							var endDt = new Date(parseInt(startDt.substring(0,
									4), 10), parseInt(startDt.substring(5, 7),
									10) - 1, parseInt(startDt.substring(8, 10),
									10)); //結束日
							return {
								minDate : endDt
							};
						}
						//	$("#startTime").timePicker();
						//	$("#endTime").timePicker();

					});

	$(document).ready(function() {
		//隐藏
		$(".tb tr").eq(0).hide();

		var tb_js = $('.tb').get(0);

		var i = tb_js.rows.length - 2;

		//复制一行
		$("#btnadd").bind('click', function() {

			var tr = $(".tb tr").eq(0).clone(true);

			tr.find("td").get(0).innerHTML = ++i;

			tr.show();

			tr.appendTo($(".tb"));

		});
		//删除
		$("#btndel").click(function() {

			$("tr:gt(0)").each(function() {

				if ($(this).find(".CK").get(0).checked == true) {

					$(this).remove();

				}

			});

		});

	});

	function deleteThisRow(rowId) {
		$("#" + rowId).remove();
	}
</script>

</head>
<body STYLE='OVERFLOW: SCROLL;'>


	<h1>行销活动管理</h1>
	<div style="color: red">
		<s:actionerror />
		<s:actionmessage />
		<s:fielderror />
	</div>




	<form name="formObj" id="formObj" action="save.do" method="post">
		<table class="tb-data" width="100%">
			<tr>
				<td colspan="2">
					<div class="f-link">
						<input type="submit" value="储存修改"> <input type="button"
							onclick="document.location='list.do'" value="回活动查询页">
					</div>
				</td>
			</tr>
			<tr>
				<th width="20%">* 活动名称</th>
				<td><input type="text" id="titleName" name="titleName"
					size="40">
				</td>
			</tr>


			<tr>
				<th>* 活动说明</th>
				<td><textarea rows="4" cols="60" id="description"
						name="description"></textarea>
				</td>
			</tr>

			<tr>
				<th>* 活动起始日期时间</th>
				<td><input name="startDate" id="startDate" size="10" value="">
					<input name="startTime" id="startTime" size="8" value=""> <span
					style="color: red">格式为： 00:00 </span></td>
			</tr>
			<tr>
				<th>* 活动结束日期时间</th>
				<td><input name="endDate" id="endDate" size="10" value="">
					<input name="endTime" id="endTime" size="8" value=""> <span
					style="color: red">格式为： 00:00 </span>
				</td>
			</tr>
			<tr>
				<th>* 支付金额</th>
				<td><input type="text" id="price" name="price" size="40">
				</td>
			</tr>

			<tr>

				<th>* 活动赠品</th>

				<td>


					<table width="100%" border="1" cellspacing="0" cellpadding="0"
						class="tb-data">
						<tr>
							<td class="bg-yl"><input type="button" id="addCol"
								value="新增" />
							</td>
							<td>
								<table width="100%" border="0" cellspacing="0" cellpadding="0"
									id="addColHere">

									<tr>
										<td>赠品编号</td>
										<td>验证赠品名称</td>
										<td>赠品数量</td>
									</tr>


								</table>
							</td>
						</tr>


					</table>
				</td>



			</tr>
			<tr>
				<th>* 赠送方式</th>
				<td><s:radio list="#{'1':'随机','0':'全部'}" name="sendWay"
						listKey="key" listValue="value" id="sendWay"></s:radio></td>

			</tr>
			<tr>
				<th>* 启用</th>
				<td><s:radio list="#{'1':'是','0':'否'}" name="status"
						listKey="key" listValue="value" id="status"></s:radio></td>
			</tr>
			<tr>
				<th>* 活動Domain</th>
				<td><s:select name="domainSrc" id="domainSrc"
						list="menuDomain.options" listKey="key" listValue="value.name" />
				</td>
			</tr>




		</table>
	</form>
















</body>

</html>